<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
                      "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!--
 layout
-->
<html>
<head>
  <title>PaperShelf</title>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8" ></meta>
  <%= stylesheet_link_tag "scaffold", "PaperShelf", :media => "all" %>
</head>
<body>

<script language="JavaScript" type="text/javascript">
<!--
function viewdiv(name)
{
var e=document.getElementById(name)
e.style.display=(e.style.display=="none")?"":"none";
}
//-->
</script>

<div id="page">
  <div id="header">
    <div class="content"></div>
   <div id="navigator"> 
    
<ul>
<li> <a href="/">Home</a></li>
      <% if session[:user_type] == "student"  or session[:user_type] == "teacher"%>
          
        <li>      <%= link_to "My Papers", :controller => 'paper_admin', :action => 'mypapers' %></li>

      <% end %>

       <% if session[:user_type] == "administrator" %>
           
        <li>     <%= link_to "User Admin", :controller => 'user_admin', :action => 'list_user' %></li>
            
      <% end %>
      
       
            <li>  <%= link_to "Papers", :controller => 'paper_admin', :action => 'list' %></li>
      
     
      <% if session[:user_type] == "student"  or session[:user_type] == "teacher"%>
      
        <li class="last">  <%= link_to "Upload Paper",   :controller => 'paper_admin', :action => 'add_paper' %></li>
      
      <% end %>
    
     <% if session[:user_id]==nil %>
       <li class="userlast">
         <%= link_to " Sign in", :controller => 'login', :action => 'login' %> 
       </li> 
       <li class="usernav">
          <%= link_to "Register ", :controller => 'register', :action => 'register' %> 
       </li>
     <% else %>
        <li class="userlast">
           <%= link_to " Sign out", :controller => 'login', :action => 'logout' %> 
         </li> 
         <li class="usernav"> <%= link_to "My Profile ", :controller => 'profile', :action => 'amend' %>
         </li>
         <li class="userwel"> Welcome, <%=session[:account]%>!
         </li>
     <% end %>
     </ul> 
</div>
</div>
  <div id="columns">
    <div id="side">
       <div id="sidesearch">
      <%= form_tag({:controller=>'paper_admin',:action => 'search'}, :multipart => true) -%>  
      &nbsp;&nbsp;<%= text_field_tag("query",nil,{:size=>15}) -%>
      <%= submit_tag("Search") -%>  
      <%= end_form_tag -%>
      </div>
        &nbsp;&nbsp;<input id="advan_search" name="advan_search"  type="checkbox" value="checkbox" onClick="viewdiv('moresearch')" />
        <lable style="">Advanced&nbsp;Search</lable>
           <div id="moresearch" style="display:none">
             <div id="advanSearchSide">
               <div class="top">Advanced Search:</div>
              <%= form_tag({:controller=>'paper_admin',:action => 'complex_search'}, :multipart => true) -%>  
                     <br>
                     <label for="category">catalog:</label>
                        <%= select ("paper", "paper_category_id",PaperCategory.find(:all).collect {|p| [ p.catagory, p.id ] })%>
                     <label for="title">title:</label>
                      <%= text_field_tag("title",nil,{:size=>14}) -%>
                     <label for="author">author: </label>
                    <%= text_field_tag("author",nil,{:size=>14}) -%>
                     <label for="publisher">publisher:</label>
                   <%= text_field_tag("publisher",nil,{:size=>14}) -%>
                        <label for="keyword">keyword:</label>
                     <%= text_field_tag("keyword",nil,{:size=>14}) -%>
            
                    <label for="abstract">abstract:</label>
                    <%= text_field_tag("abstract",nil,{:size=>14}) -%>
                    <label for="Summary">summary:&nbsp;&nbsp;</label>
                   <%= text_field_tag("summary",nil,{:size=>14}) -%>
                  <br>
                  <p>
                    <%= submit_tag "Search", :class => "submit", :disable_with => "Searching..." %>
                  </p>
                 <%= end_form_tag %>			
              </div>
            </div>

      <div id="topdownload">
        <div class="top">Top Papers:</div>
<ul>
        <% @toppapers=Paper.toppapers %>
        <% for eachpaper in @toppapers%>
          <li><%= link_to eachpaper.title, :controller=>'paper_admin', :action => 'show', :id => eachpaper %> &nbsp;&nbsp;&nbsp;[<%=h eachpaper.viewcount%>]</li> 
        <% end %>
        </ul>
       </div>
      <div id="recentupload">
        <div class="top">Recent Upload:</div>
        <ul>
        <% @recentpapers=Paper.recentpapers %>
        <% for eachpaper in @recentpapers%>
          <li><%= link_to eachpaper.title, :controller=>'paper_admin', :action => 'show', :id => eachpaper %> &nbsp;&nbsp;&nbsp;[<%= eachpaper.time_from_now_str%>]</li>
        <% end %>
        </ul>
      </div>
      <div id="recentcomment"></div>
    </div>
    <div id="main">
    <% if flash[:notice] -%>
      <div id="notice"><%= flash[:notice] %></div>
    <% end -%>
    <%= yield :layout %>
    </div>
  </div>
   <div id="copyright">
		<p>&copy; Copyright 2007 Paper Shelf| <a href="http://www.ss.pku.edu.cn">Site Design by SOA Group</a></p>
			<ul>
				<li><a href="/login" title="Home">Home</a> | </li>
				<li>Contact us:10717107@pub.ss.pku.edu.cn</li>
			</ul>

  </div>
</div>
</body>
</html>
